<html>
<link rel="icon" href="/static/images/userimg/default.png">

<head>
    <title>
        东方跳蚤市场注册页面
    </title>
    <link crossorigin="anonymous" href="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css"
          integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" rel="stylesheet"/>
    <meta content="width=device-width, initial-scale=1" name="viewport"/>
    <style>
        body {
            background: linear-gradient(to right, #56ccf2, #2f80ed);
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            font-family: 'Arial', sans-serif;
            margin: 0;
            padding: 0;
        {#background-image: url('../static/images/171022031721.jpg');#}
        }

        .container {
            display: flex;
            width: 100%;
            max-width: 1200px;
            height: 600px;
            background: white;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            overflow: hidden;
        }

        .login-container {
            padding: 20px;
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        .login-form {
            display: flex;
            flex-direction: column;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .form-control {
            border: 1px solid #ccc;
            border-radius: 5px;
            padding: 10px;
            font-size: 14px;
        }

        .login-btn {
            background-color: #2f80ed;
            color: white;
            border: none;
            border-radius: 5px;
            padding: 10px;
            font-size: 16px;
            cursor: pointer;
        }

        .forgot-password {
            text-align: center;
            font-size: 12px;
            color: #666;
            margin-top: 10px;
        }

        .logo {
            display: flex;
            justify-content: center;
            margin-bottom: 20px;
        }

        .logo img {
            width: 50px;
            height: 50px;
        }

        .illustration {
            flex: 1.5;
        }

        .illustration img {
            width: 110%;
            height: 100%;
            object-fit: cover;
        }

        .captcha {
            display: flex;
            align-items: center;
        }

        .captcha img {
            height: 38px;
            margin-left: 10px;
        }

        @media (max-width: 768px) {
            .container {
                flex-direction: column;
                height: auto;
            }

            .illustration {
                order: -1;
            }

            .login-container, .illustration {
                flex: none;
                width: 100%;
            }
        }
    </style>

</head>
<body>


<div class="container">
    <div class="login-container">
        <div class="logo">
            <img alt="Shanghai Conservatory of Music logo" src="../../static/images/default.png"/>
        </div>
        <h5 class="text-center">
            开启新生活
        </h5>
        <form class="login-form">
    <div class="form-group">
        <input class="form-control" placeholder="请输入用户名（纯英文）" type="text" id="username" pattern="[A-Za-z]{8,16}" title="用户名只能包含8-16位的英文字母" required/>
    </div>
    <div class="form-group">
        <input class="form-control" placeholder="请输入手机号" type="text" id="phone" required/>
    </div>
    <div class="form-group">
        <input class="form-control" placeholder="请输入邮箱" type="text" id="mail" required/>
    </div>
    <div class="form-group">
        <div style="display: flex; justify-content: space-between;">
            <input class="form-control" style="flex: 1; margin-right: 10px;" placeholder="请输入邮箱验证码" type="text" id="smsCode" required/>
            <button class="login-btn" style="width: auto;" type="button" id="sendSmsCode">
                发送邮箱验证码
            </button>
        </div>
    </div>
    <div class="form-group">
        <input class="form-control" placeholder="请输入密码" type="password" id="password" pattern=".{8,16}" title="密码必须是8-16位" required/>
    </div>
    <button class="login-btn" type="submit" id="register">
        注册
    </button>
    <p><a href="/login">已有账号？前往登录</a></p>
</form>
        <div class="forgot-password">
            <a href="#">
                Forgot Password?
            </a>
        </div>
    </div>
    <div class="illustration">
        <img class="img1" alt="Illustration of a futuristic cityscape representing the Shanghai Conservatory of Music"
             src="../../static/images/R-C.jpg"/>
    </div>
</div>
<script src="{{ url_for('static', filename='js/register.js') }}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"></script>
<script>
window.onload = function() {
    var password = document.getElementById('password');
    var register = document.getElementById('register');

    register.disabled = true;  // 初始设置注册按钮为不可点击

    // 监听密码输入框的输入事件
    password.oninput = function() {
        // 当密码有输入时，注册按钮可点击
        if(password.value) {
            register.disabled = false;
        } else {
            register.disabled = true;
        }

    }
}

</script>
</body>
</html>